<template>
  <div class="dashboard-container">
    <div class="dashboard-text">
      <el-card>
        <el-row style="flex" justify="center">
          房产管理首页
        </el-row>
        <hr>
        <el-row style="flex" justify="end">
          <!-- <el-rol> -->
          <div ref="LineChart" class="pie" />
          <!-- </el-rol> -->
          <!-- <el-rol> -->
          <div ref="rightChart" class="rightChart" />
          <!-- </el-rol> -->
        </el-row>
      </el-card>
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts'
export default {
  name: 'Dashboard',
  computed: {
  },

  mounted() {
    // 左边图
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(this.$refs.LineChart)
    // 绘制图表
    myChart.setOption({
      title: {
        text: '人员'
      },

      legend: {
        data: ['公司', '职位', '房产', 'Direct', 'Search Engine']
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },

      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['小红', '经纪人', '广博', '天佑', '自强', '豫', '墨池']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: '公司',
          type: 'line',
          stack: 'Total',
          data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
          name: '职位',
          type: 'line',
          stack: 'Total',
          data: [220, 182, 191, 234, 290, 330, 310]
        },
        {
          name: '房产',
          type: 'line',
          stack: 'Total',
          data: [150, 232, 201, 154, 190, 330, 410]
        }
      ]
    })

    // 右边的图
    // 右边图
    // 基于准备好的dom，初始化echarts实例
    var rightChart = echarts.init(this.$refs.rightChart)
    // 绘制图表
    rightChart.setOption({
      tooltip: {
        trigger: 'item'
      },
      legend: {
        top: '5%',
        left: 'center'
      },
      series: [
        {
          name: '人员',
          type: 'pie',
          radius: ['30%', '70%'],
          avoidLabelOverlap: false,
          itemStyle: {
            borderRadius: 10,
            borderColor: '#fff',
            borderWidth: 2
          },
          label: {
            show: false,
            position: 'center'
          },
          emphasis: {
            label: {
              show: true,
              fontSize: '40',
              fontWeight: 'bold'
            }
          },
          labelLine: {
            show: false
          },
          data: [
            { value: 1048, name: '雅居乐集团' },
            { value: 735, name: '长虹国际' },
            { value: 580, name: '金域医学' },
            { value: 484, name: '广汽集团' },
            { value: 300, name: '奥园美谷科技' }
          ]
        }
      ]
    })
  }

}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
.pie{
  width: 45%;
  height: 400px;
  display: inline-table;
}
.rightChart{
  // margin-left: px;
  width: 50%;
  height: 400px;
  display: inline-table;

}
el-card{
  background-color: pink;

}

</style>
